Make tooltip positioning Xinerama-aware. (#127332)
authorMatthias Clasen <maclas@gmx.de>
Sun, 23 Nov 2003 21:27:50 +0000 (21:27 +0000)
committerMatthias Clasen <matthiasc@src.gnome.org>
Sun, 23 Nov 2003 21:27:50 +0000 (21:27 +0000)
Sun Nov 23 22:26:25 2003  Matthias Clasen  <maclas@gmx.de>

* gtk/gtktooltips.c (gtk_tooltips_draw_tips): Make tooltip
positioning Xinerama-aware.  (#127332)

ChangeLog
ChangeLog.pre-2-10
ChangeLog.pre-2-4
ChangeLog.pre-2-6
ChangeLog.pre-2-8
gtk/gtktooltips.c

index 934427cb646909a4c3dcd9602efe4ec1a347bb9f..6a68c28b134db28a4d47071d30112baaca75ada8 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Sun Nov 23 22:26:25 2003  Matthias Clasen  <maclas@gmx.de>
+
+       * gtk/gtktooltips.c (gtk_tooltips_draw_tips): Make tooltip 
+       positioning Xinerama-aware.  (#127332)
+
 Fri Nov 21 01:57:21 2003  Matthias Clasen  <maclas@gmx.de>
 
        * gdk/x11/gdkscreen-x11.c (init_xinerama_support): Make monitor
index 934427cb646909a4c3dcd9602efe4ec1a347bb9f..6a68c28b134db28a4d47071d30112baaca75ada8 100644 (file)
@@ -1,3 +1,8 @@
+Sun Nov 23 22:26:25 2003  Matthias Clasen  <maclas@gmx.de>
+
+       * gtk/gtktooltips.c (gtk_tooltips_draw_tips): Make tooltip 
+       positioning Xinerama-aware.  (#127332)
+
 Fri Nov 21 01:57:21 2003  Matthias Clasen  <maclas@gmx.de>
 
        * gdk/x11/gdkscreen-x11.c (init_xinerama_support): Make monitor
index 934427cb646909a4c3dcd9602efe4ec1a347bb9f..6a68c28b134db28a4d47071d30112baaca75ada8 100644 (file)
@@ -1,3 +1,8 @@
+Sun Nov 23 22:26:25 2003  Matthias Clasen  <maclas@gmx.de>
+
+       * gtk/gtktooltips.c (gtk_tooltips_draw_tips): Make tooltip 
+       positioning Xinerama-aware.  (#127332)
+
 Fri Nov 21 01:57:21 2003  Matthias Clasen  <maclas@gmx.de>
 
        * gdk/x11/gdkscreen-x11.c (init_xinerama_support): Make monitor
index 934427cb646909a4c3dcd9602efe4ec1a347bb9f..6a68c28b134db28a4d47071d30112baaca75ada8 100644 (file)
@@ -1,3 +1,8 @@
+Sun Nov 23 22:26:25 2003  Matthias Clasen  <maclas@gmx.de>
+
+       * gtk/gtktooltips.c (gtk_tooltips_draw_tips): Make tooltip 
+       positioning Xinerama-aware.  (#127332)
+
 Fri Nov 21 01:57:21 2003  Matthias Clasen  <maclas@gmx.de>
 
        * gdk/x11/gdkscreen-x11.c (init_xinerama_support): Make monitor
index 934427cb646909a4c3dcd9602efe4ec1a347bb9f..6a68c28b134db28a4d47071d30112baaca75ada8 100644 (file)
@@ -1,3 +1,8 @@
+Sun Nov 23 22:26:25 2003  Matthias Clasen  <maclas@gmx.de>
+
+       * gtk/gtktooltips.c (gtk_tooltips_draw_tips): Make tooltip 
+       positioning Xinerama-aware.  (#127332)
+
 Fri Nov 21 01:57:21 2003  Matthias Clasen  <maclas@gmx.de>
 
        * gdk/x11/gdkscreen-x11.c (init_xinerama_support): Make monitor
index 82e9d32bdca2f4b81d1bc263fba0bc4fcec575ec..97bb782c7b1397370cfbc7560d94bbffa7ad210f 100644 (file)
@@ -390,10 +390,13 @@ gtk_tooltips_draw_tips (GtkTooltips *tooltips)
   GtkRequisition requisition;
   GtkWidget *widget;
   GtkStyle *style;
-  gint x, y, w, h, scr_w, scr_h;
+  gint x, y, w, h;
   GtkTooltipsData *data;
   gboolean keyboard_mode;
   GdkScreen *screen;
+  GdkScreen *pointer_screen;
+  gint monitor_num, px, py;
+  GdkRectangle monitor;
 
   if (!tooltips->tip_window)
     gtk_tooltips_force_window (tooltips);
@@ -410,8 +413,6 @@ gtk_tooltips_draw_tips (GtkTooltips *tooltips)
   gtk_tooltips_update_screen (tooltips, FALSE);
   
   screen = gtk_widget_get_screen (widget);
-  scr_w = gdk_screen_get_width (screen);
-  scr_h = gdk_screen_get_height (screen);
 
   data = tooltips->active_tips_data;
 
@@ -436,12 +437,22 @@ gtk_tooltips_draw_tips (GtkTooltips *tooltips)
 
   x -= (w / 2 + 4);
 
-  if ((x + w) > scr_w)
-    x -= (x + w) - scr_w;
-  else if (x < 0)
-    x = 0;
+  gdk_display_get_pointer (gdk_screen_get_display (screen),
+                          &pointer_screen, &px, &py, NULL);
+  if (pointer_screen != screen) 
+    {
+      px = x;
+      py = y;
+    }
+  monitor_num = gdk_screen_get_monitor_at_point (screen, px, py);
+  gdk_screen_get_monitor_geometry (screen, monitor_num, &monitor);
+
+  if ((x + w) > monitor.x + monitor.width)
+    x -= (x + w) - (monitor.x + monitor.width);
+  else if (x < monitor.x)
+    x = monitor.x;
 
-  if ((y + h + widget->allocation.height + 4) > scr_h)
+  if ((y + h + widget->allocation.height + 4) > monitor.y + monitor.height)
     y = y - h - 4;
   else
     y = y + widget->allocation.height + 4;